<template>
  <view class="container">
    <view class="content">
      <view class="module">
        <view class="module-title">
          <view class="module-label"></view>
          <text class="module-text">物料质检</text>
        </view>
        <view class="module-content">
          <view class="grid">
            <view class="grid-item" @click="handleClick('物料质检方案')">
              <image class="grid-icon" src="/static/images/icon-handle.png"></image>
              <text class="grid-text">质检方案</text>
            </view>
            <view class="grid-item" @click="handleClick('物料质检指标')">
              <image class="grid-icon" src="/static/images/icon-abnormal-pro.png"></image>
              <text class="grid-text">质检指标</text>
            </view>
          </view>
        </view>
      </view>

      <view class="module">
        <view class="module-title">
          <view class="module-label"></view>
          <text class="module-text">产品质检</text>
        </view>
        <view class="module-content">
          <view class="grid">
            <view class="grid-item" @click="handleClick('产品质检方案')">
              <image class="grid-icon" src="/static/images/icon-handle.png"></image>
              <text class="grid-text">质检方案</text>
            </view>
            <view class="grid-item" @click="handleClick('产品质检指标')">
              <image class="grid-icon" src="/static/images/icon-abnormal-pro.png"></image>
              <text class="grid-text">质检指标</text>
            </view>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  methods: {
    handleClick(moduleName) {
      const routes = {
        '物料质检方案': '/pages/matirialQualityPlan/index',
        '物料质检指标': '/pages/matirialQualityStandard/index',
        '产品质检方案': '/pages/productQualityPlan/index',
        '产品质检指标': '/pages/productQualityStandard/index'
      };
      
      if (routes[moduleName]) {
        uni.navigateTo({ url: routes[moduleName] });
      }
    }
  }
};
</script>

<style>
page {
  height: 100%;
  background-color: #f9f9f9;
}

.container {
  height: 100%;
  padding: 40rpx;
  box-sizing: border-box;
}

.content {
  flex: 1;
  overflow-y: auto;
}

.module {
  margin-bottom: 60rpx;
  background-color: #ffffff;
  border-radius: 20rpx;
  padding: 24rpx;
  box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
}

.module-title {
  display: flex;
  align-items: center;
  margin-bottom: 30rpx;
}

.module-label {
  width: 12rpx;
  height: 24rpx;
  background: linear-gradient(180deg, #4080ff, #68b0ff);
  border-radius: 12rpx;
  margin-right: 16rpx;
}

.module-text {
  font-size: 20rpx;
  color: #2c3e50;
  font-weight: 600;
}

.grid {
  display: flex;
  justify-content: space-around;
  gap: 40rpx;
}

.grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.grid-item:hover {
  transform: translateY(-10rpx);
  box-shadow: 0 8rpx 16rpx rgba(0, 0, 0, 0.1);
}

.grid-icon {
  width: 60rpx;
  height: 60rpx;
  margin-bottom: 16rpx;
}

.grid-text {
  font-size: 16rpx;
  color: #34495e;
  line-height: 1.4;
}

.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100rpx;
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-around;
  border-top: 1rpx solid #e0e0e0;
  box-shadow: 0 -4rpx 8rpx rgba(0, 0, 0, 0.1);
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #7f8c8d;
  transition: color 0.2s ease;
}

.tab-item.active {
  color: #4080ff;
}

.tab-text {
  font-size: 14rpx;
  margin-top: 8rpx;
}
</style>
